package com.dingding.service.common.core.dao.impl;

import java.util.Date;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.dingding.common.core.base.dao.impl.BaseDaoImpl;
import com.dingding.common.core.beans.Vehicleinfo;
import com.dingding.common.core.util.ToolUtil;
import com.dingding.service.common.core.dao.IVehicleinfoDao;

@Component("vehicleinfoDao")
public class VehicleinfoDaoImpl extends BaseDaoImpl<Vehicleinfo> implements IVehicleinfoDao {

	/**
	 * @Title: saveVehicleInfoByNum 
	 * @Description: 保存用户车辆信息
	 * @param loginId 用户ID
	 * @author CHEHAUNBO
	 */
	@Transactional(propagation = Propagation.REQUIRED)
	public void addVehicleInfo(String loginId) {

		Vehicleinfo vehicleinfo = new Vehicleinfo();
		// viid
		vehicleinfo.setUvId(ToolUtil.getUid());
		// loginId
		vehicleinfo.setLoginId(loginId);
		// 认证时间
		vehicleinfo.setCreateTime(new Date());
		// 认证状态 0:保留
		vehicleinfo.setVstatus(0);
		// 是否认证
		vehicleinfo.setIsAuth(1);

		try {
			super.save(vehicleinfo);
		} catch (Exception e) {
			log.error("添加用户车辆信息！", e);
		}
	}

}
